package com.zhangliuliu.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhangliuliu.bean.AreaBean;
import com.zhangliuliu.service.AreaService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("area")
public class areaController {
    @Resource
    private AreaService areaService;

    @RequestMapping("add")
    @ResponseBody
   public void addArea(AreaBean areaBean){
        areaService.addArea(areaBean);
    }
    @RequestMapping("cutByItem")
    IPage<AreaBean> cutByItem(@RequestParam(value = "pageNO",defaultValue = "1") int pageNo,
                              @RequestParam(value = "pageSize",defaultValue = "4") int pageSize,
                              @RequestParam("name") String name, @RequestParam("kind") String kind,
                              @RequestParam ("groupName") String groupName){
      return areaService.cutByItem(pageNo,pageSize,name,kind,groupName);

}   @RequestMapping("cutByItem1")
    IPage<AreaBean> cutByItem1(@RequestParam(value = "pageNO",defaultValue = "1") int pageNo,
                               @RequestParam(value = "pageSize",defaultValue = "4") int pageSize
                              ){
        return areaService.cutByItem1(pageNo,pageSize);
    }
}
